import json, requests

def select():
    enum = input('请输入运单号：')
    url = 'http://www.kuaidi100.com/query?type=youshuwuliu&postid='+enum+'&temp=0.628359860946412&phone='
    req = requests.get(url)
   # print(req.text)
    if req.status_code == 200:
        if json.loads(req.text)['status'] == '200':
            print('物流公司：%s' % json.loads(req.text)['com'])
            for item in json.loads(req.text)['data']:
                print(item['time'], item['context'],'---',item['location'])
        else:
            print(json.loads(req.text)['message'])


select()
